<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>
    .el-tabs__item.is-active{
      color: #058142;
    }.el-tabs__active-bar{
      background-color: #058142;
    }.el-tabs{
      background-color: #fff;
    }.el-input__inner{
      border: 0;
      font-size: 1rem;
      text-align: center;
    }.el-input__prefix{
      display: none;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">值班管理-碰头会</div>
      </div>
      <!--  -->
      <div class="x-ico-month">
        <el-date-picker v-model="cardsmonth" type="date" placeholder="选择月" @change="getmonth" format="yyyy 年 MM 月 dd 日" value-format="yyyyMMdd" :editable="notkey"></el-date-picker>
      </div>
      <!--  -->
      <div class="x-inui-bgbox">

        <template>
          <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true">
            <el-tab-pane label="复盘提案" name="first">
              <!--  -->
              <div class="x-pro-list" v-for="(item,index) in prodata" :key="item.key">
                <div class="x-pro-top">提案{{index+1}}</div>
                <div class="x-pro-row">
                  <div class="x-pro-label">提案人:</div>
                  <div class="x-pro-input">
                    <el-input placeholder="请输入内容" v-model="item.username" :disabled="isfromindex"></el-input>
                  </div>
                </div>
                <div class="x-pro-row x-pro-rowblock">
                  <div class="x-pro-label">提案内容:</div>
                  <div class="x-pro-input">
                    <el-input placeholder="请输入内容" v-model="item.question" type="textarea" :rows="4" :disabled="isfromindex"></el-input>
                  </div>
                </div>
                <div class="x-pro-row x-pro-rowblock">
                  <div class="x-pro-label">分析成因:</div>
                  <div class="x-pro-input">
                    <el-input placeholder="请输入内容" v-model="item.reason" type="textarea" :rows="4" :disabled="isfromindex"></el-input>
                  </div>
                </div>
                <div class="x-pro-row x-pro-rowblock">
                  <div class="x-pro-label">改善提议:</div>
                  <div class="x-pro-input">
                    <el-input placeholder="请输入内容" v-model="item.improve" type="textarea" :rows="4" :disabled="isfromindex"></el-input>
                  </div>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane label="行动计划" name="second">
              <template>
                <el-table :data="tableDatatwo">
                  <el-table-column label="序号" width="50" type="index" fixed></el-table-column>
                  <el-table-column label="计划标题" width="" fixed>
                    <template slot-scope="scope">
                      {{scope.row.title}}
                    </template>
                  </el-table-column>
                  <el-table-column label="完成时间" width="" prop="finish_time">

                  </el-table-column>
                  <el-table-column label="负责人" width="" prop="liable_username">

                  </el-table-column>
                  <el-table-column label="追踪人" width="" prop="tracker_username">

                  </el-table-column>
                  <el-table-column label="行动步骤">
                      <el-button type="text" @click="editfavo(scope.row.title,scope.row.content)">查看</el-button>
                  </el-table-column>
                </el-table>
              </template>
            </el-tab-pane>
          </el-tabs>
        </template>
      </div>
      <!--  -->
      <el-dialog :title="toasttitle" :visible.sync="edittoast" width="90%" center="true" close-on-click-modal="false" show-close="false">
        <span>{{toastcon}}</span>
      </el-dialog>
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {

  $api.fixStatusBar($api.byId('header'));


    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          cardsmonth:'',
          activeName: 'first',
          tableData:[],
          tableDatatwo:[],
          istype:'0',
          tableDatayead:[],
          itemKey:'',
          notkey:false,
          prodata:'',
          edittoast:false,
          toasttitle:'',
          toastcon:'',
          isfromindex:true,

        }
      },
      created:function() {
        var that=this;

      },
      mounted:function(){
        var that=this;
        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var day = date.getDate()
        if(month<10){
          month = '' + 0 + month;
        }
        if(day<10){
          day = '' + 0 + day;
        }
        var toMonth = '' + year + month +  day;
        console.log(toMonth);
        that.cardsmonth = toMonth;
        that.getdatafirst()

      },
      methods: {
        //
        editfavo:function(title,content){
          var that = this;
          that.toasttitle = title;
          that.toastcon = content;
          that.edittoast = true;
        },
        //月份
        getmonth:function(val){
          var that = this;
          console.log(val);
          that.cardsmonth = val;
          if(that.istype=='0'){
            that.getdatafirst()
          }else if(that.istype=='1'){
            that.getdatatwo()
          }

        },
        //选项卡
        handleClick(tab, event) {
          let id = event.target.getAttribute('id').split('-');
          let whitetab = id.join('').substring(3,9);
          let that = this;
          if(whitetab=='first'){//
            that.istype = '0';
            that.getdatafirst()
          }else if(whitetab=='second'){//
            that.istype = '1';
            that.getdatatwo()
          }
        },
        //
        getdatafirst:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/duty/getBmp',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.prodata = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //
        getdatatwo:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/duty/getBma',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableDatatwo = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },

      }
    })
	}


	</script>
</body>
</html>
